//
//  CTUserDefaultHelper.m
//  CT
//
//  Created by liufanwei on 15/4/7.
//  Copyright (c) 2015年 liufanwei. All rights reserved.
//

#import "CTUserDefaultHelper.h"

@interface CTUserDefaultHelper(){
    
}

@end


@implementation CTUserDefaultHelper


+(CTUserDefaultHelper*)ShareInstance{
    static dispatch_once_t onceToken;
    static CTUserDefaultHelper * helper;
    dispatch_once(&onceToken, ^{
        helper = [[CTUserDefaultHelper alloc] init];
    });
    return helper;
}

-(void)cleanData{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:kAccount];
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:kPassword];
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:kMoney];
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:kShowNumber];
}

-(NSString*)Account{
    return [[NSUserDefaults standardUserDefaults] valueForKey:kAccount];
}

-(void)setAccount:(NSString *)Account{
    [[NSUserDefaults standardUserDefaults] setObject:Account forKey:kAccount];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

-(NSString*)Money{
    NSString * money = [[NSUserDefaults standardUserDefaults] valueForKey:kMoney];
    return money;
}

-(void)setMoney:(NSString *)Money{
    [[NSUserDefaults standardUserDefaults] setObject:Money forKey:kMoney];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

-(NSString*)PWD{
    NSString * pwd = [[NSUserDefaults standardUserDefaults] valueForKey:kPassword];
    return pwd;
}

-(void)setPWD:(NSString *)pwd{
    [[NSUserDefaults standardUserDefaults] setObject:pwd forKey:kPassword];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

-(BOOL)ShowNumber{
    return[[NSUserDefaults standardUserDefaults] boolForKey:kShowNumber];
}

-(void)setShowNumber:(BOOL)ShowNumber{
    [[NSUserDefaults standardUserDefaults]setBool:ShowNumber forKey:kShowNumber];
    [[NSUserDefaults standardUserDefaults] synchronize];
}
@end
